package com.zsl.sharp_team00b.controller;

import com.zsl.sharp_team00b.entity.Result;
import com.zsl.sharp_team00b.entity.User;
import com.zsl.sharp_team00b.service.UserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
@Tag(name="用户管理")
@CrossOrigin
public class UserController {


    @Autowired
    private UserService service;

    @Operation(summary = "hello")
    @GetMapping("/hello")
    public String hello(){

        return  "hello";
    }

    @PostMapping("/login")
    public Result login(User user){
        return  service.login(user);
    }

    @PostMapping("/save")
    public Result save(User user){
        return  service.saveEntity(user);
    }


}
